﻿@{
    ViewBag.Title = "EasyHotel酒店管理系统登陆 Powered by IEMSOFT";
}
@section header
{
    <style type="text/css">
        #divLogin
        {
            width: 480px;
            margin: auto;
            padding-top: 10%;
        }

        .LoginTitle
        {
            text-align: center;
            font-weight:bold;
            color:#2984a4
        }

        .panel-body table tr td
        {
            margin-bottom: 10px;
            height: 50px;
        }
    </style>
}

<div class="container">
    <div id="divLogin" style="margin: auto">
        <div class="easyui-panel" title="EasyHotel登陆"
            style="width: 480px; padding: 30px 70px 20px 70px" data-options="headerCls:'LoginTitle'">
            <form id="formLogin" class="easyui-form" data-options="novalidate:true">
                <table>
                    <tr>
                        <td>
                            <label>集团名称：</label>
                        </td>
                        <td>
                            <select id="cbGroupHotel" class="easyui-combobox" name="GroupHotelId" style="width: 250px; height: 40px; padding: 12px"
                                data-options="url:'/grouphotel/option',method:'get',valueField:'value',textField:'text'">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="UserName">用户名：</label>
                        </td>
                        <td>
                            <input class="easyui-textbox" style="width: 250px; height: 40px; padding: 12px" name="UserName"
                                data-options="prompt:'用户名',iconCls:'icon-man',iconWidth:38,required:true">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="Password">密码：</label>
                        </td>
                        <td>
                            <input class="easyui-textbox" style="width: 250px; height: 40px; padding: 12px" name="Password"
                                type="password" data-options="prompt:'密码',iconCls:'icon-lock',iconWidth:38,required:true" id="txtPassword">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label>职务：</label>
                        </td>
                        <td>
                            <select id="cbRole" class="easyui-combobox" name="RoleId" style="width: 250px; height: 40px; padding: 12px"
                                data-options="url:'/role/option',method:'get',valueField:'value',textField:'text'">
                            </select>
                        </td>
                    </tr>
                </table>
                <div>
                    <a href="javascript:void()" class="easyui-linkbutton c6"
                        data-options="iconCls:'icon-ok'" style="padding: 5px 0px; width: 100%;"
                        onclick="login()">
                        <span style="font-size: 14px;">登陆</span>
                    </a>
                </div>
            </form>
        </div>
    </div>
</div>

@section Scripts
{
    <script type="text/javascript">
        $(function () {
            $('input[type=password]').keyup(function (event) {
                if (event.keyCode == 13) {
                    $(this).blur();
                    login();
                }
            });
        })
        function login() {
            var msgTitle = "用户登陆";
            if ($('#formLogin').form('enableValidation').form('validate')) {
                $.post('/account/login',
                    $('#formLogin').serialize(),
                    function (data) {
                        var msg = '';
                        if (data.msg.length != 0) {
                            $.each(data.msg, function (index, item) {
                                msg = msg + item + '<br/>';
                            });
                            $.messager.alert(msgTitle, msg, 'error');
                          
                        }
                        else {
                            top.location.href = '/?returnurl=' +'@ViewBag.ReturnUrl';
                        }
                    });
            }
        }
    </script>
}

